<template>
	<view class="box-bg">
		<uni-nav-bar left-icon="left" @clickLeft="back" rightText="全部已读" @clickRight="allread" class="topnavbar">
			<view class="bartitle">消息中心</view>
			</uni-nav-bar>
		<view>
			<index-tabbar :tabBars="tabBars" @TarTap="TarData" :tabIndex="tabIndex" class="topbar"></index-tabbar>
			<component v-bind:is="currentTabComponent"></component>
		</view>

	</view>


</template>

<script>
	import indexTabbar from './topBar.vue';
	import supplyOfGoods from './Supply-of-goods/Supply-of-goods.vue';
	import system from './System/System.vue';
	export default {
		components: {
			indexTabbar,
			supplyOfGoods,
			system
		},
		data() {
			return {
				tabIndex: "supplyOfGoods",
				tabBars: [{
						name: "货源",
						id: "supplyOfGoods"
					},
					{
						name: "系统",
						id: "system"
					}
				],
				currentTabComponent: "supplyOfGoods"
			}
		},
		methods: {
			TarData(item) {
				this.tabIndex = item.id;
				this.currentTabComponent = item.id
			},
			back(){
				uni.switchTab({
					url: "/pages/found-goods/found-goods"
				})
			},
			allread(){
				uni.$showSucc("全部已读")
			}
		}
	}
</script>

<style>
	.topbar {
		color: #fff;
	}

	.box-bg {
		background-color: #fff;
		height: 45px;
	}

	.top {
		font-size: 34rpx;
	}
	.bartitle{
		
		margin: 0 auto;
		font-size: 36rpx;
		color: #000;
		font-weight: 600;
		margin-top: 20rpx;
	}
	.barright{
		margin:auto 0;
		margin-right: -100rpx;
	}
	
</style>
